package com.share.wechat.core.controller;

import com.share.wechat.core.entity.UserDetail;
import org.apache.log4j.Logger;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/core/userDetail/")
public class UserDetailController {
    private final Logger logger = Logger.getLogger(this.getClass());
    /**
     *
     * @param code code
     * @return UserDetail
     */
    @GetMapping("login")
    public UserDetail findOneByCode(String code){
        if (StringUtils.isEmpty(code)){
            logger.info("code为空 不能返回结果!");
            return null;
            // TODO: 2017/11/22
        }
        return null;
    }

    /**
     * 拿到小程序开发者的相关信息
     * @return Map
     */
    @GetMapping("getAppId")
    public Map<String,String> getAppIdAndSecret(){
        Map<String,String> returnMap = new HashMap<>();
        String appId = "wxe9ed088255e9972d";
        String AppSecret = "a16947befb7c4ccce62ac4b0d704c105";
        returnMap.put("appId",appId);
        returnMap.put("appSecret",AppSecret);
        logger.info("拿到的开发者的信息为"+returnMap);
        return returnMap;
    }






}
